// 搜索管理模块
let searchModule = {
	state:{
		value:"",
		history_search_list:[]
	},
	mutations:{
		set_val(state,val){
			state.value = val;
		},
		set_history_search(state,payload){
			for(let i = 0; i < state.history_search_list.length;i++){
				if(state.history_search_list[i].val == payload.val){
					state.history_search_list.splice(i,1);
				}
			}
			state.history_search_list.unshift(payload);
		},
		remove_history_search(state,time){
			for(let i = 0; i < state.history_search_list.length;i++){
				if(state.history_search_list[i].time == time){
					state.history_search_list.splice(i,1);
				}
			}
		}
	},
	getters:{
		val:state=>state.value,
	}
}
export { searchModule }